public class Chef implements Runnable{
    private  Orders orders;
    private  Waiter waiter;

    public void setOrders(Orders orders) {
        this.orders = orders;
    }

    public void setWaiter(Waiter waiter) {
        this.waiter = waiter;
    }

    @Override
    public void run() {
        while(true){
            synchronized (this){
                try{
                    System.out.println("厨师空闲中++++++++++++");
                    this.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            try{
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("厨师完成做菜，通知waiter取餐++++++++++");
            synchronized (this.waiter){
                waiter.setMsgID(2);
                waiter.notify();
            }
        }
    }

}
